package guoanmaker.operator.business.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import guoanmaker.operator.business.service.OperatorBusinessService;
import guoanmaker.operator.helper.common.AjaxJson;
import guoanmaker.operator.helper.common.abstractobj.ApiController;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(ApiController.OPERATOR_USER)
public class OperatorBusinessServiceRangeController {

	@Resource
	private AjaxJson ajaxJson;
	
	@Resource
	private OperatorBusinessService  operatorBusinessService;
	
	
	/**
	 * 
	 * @param page
	 * @param size
	 * @param status  1----> 待审核    3----》已拒绝   2-----》已通过
	 * @return
	 */
	@ApiOperation(value = "按照状态查询服务范围变更列表")
	@RequestMapping(value ="pendingServicecategoryList",method = RequestMethod.POST)
	public AjaxJson pendingServicecategoryList(@RequestParam(value = "page", defaultValue = "0") Integer page,
            @RequestParam(value = "size", defaultValue = "10") Integer size,Integer status){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorBusinessService.pendingServicecategoryList(page,size,status));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	@ApiOperation(value = "查看审批记录")
	@RequestMapping(value ="Servicecategoryinfo",method = RequestMethod.POST)
	public AjaxJson Servicecategoryinfo(String id){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorBusinessService.Servicecategoryinfo(id));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	/**
	 * 
	 * @param id
	 * @param userid
	 * @return
	 */
	@ApiOperation(value = "审核服务种类")
	@RequestMapping(value ="auditbusinessService",method = RequestMethod.POST)
	public AjaxJson auditbusinessService(String id,String userid){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorBusinessService.auditbusinessService(id,userid));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	/**
	 * 
	 * @param id
	 * @param content
	 * @param reason
	 * @param userid
	 * @return
	 */
	//拒绝商户
	@ApiOperation(value = "拒绝服务种类")
	@RequestMapping(value ="refusebusinessService",method = RequestMethod.POST)
	public  AjaxJson refusebusinessService(String id,String content,String reason,String userid){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorBusinessService.refusebusinessService(id,content,reason,userid));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	@ApiOperation(value = "查看变动信息和审核记录")
	@RequestMapping(value ="selectChangeRecordandAudiet",method = RequestMethod.POST)
	public  AjaxJson selectChangeRecordandAudiet(String id){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorBusinessService.selectChangeRecordandAudiet(id));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	
	
	
	
}
